var maincontent;
var myExtend;
var nodeTree;
var currentHref= 'desktop';

//file translate 
var fileType = "uploaded";
var selectFiles = {};

// 页面dom ready 时间初始化
$(function() {	
	
	var setting = {
				async : {
					enable : true,
					url : "admin/treenode/tree-node!ztree",
					autoParam : ["id=bean.id"],
					otherParam:{}
	            },
				callback: {
				    //onAsyncSuccess: zTreeOnAsyncSuccess,
				    onClick:zTreeOnClickMain
				}
	 };
	 var root = {
		  	  name : "西安北方特种能源有限公司西安庆华公司",
				  open : true,
				  nocheck:true,
				  id:"root",
				  isParent:true
	  } ;
	  var zNodes = [
		     root                      
	      ];
	 zTreeObj = $.fn.zTree.init($("#navigateTree"), setting,zNodes);
	
	 var nodes = zTreeObj.getNodes();

	 zTreeObj.expandNode(nodes[0]);	
	 desktop();

});// end of dom ready

function zTreeOnClickMain(event, treeId, treeNode) {
    if(treeNode.isParent){
    	zTreeObj.expandNode(treeNode);
    	return;
    };
    //var link = treeNode.attrs['prefix']+treeNode.href;    
    var link = treeNode.href;    
    doGet(link);
}

// menu action
function myprofile(){
	doGet("admin/user/profile");	
}

function desktop(){
	doGet('desktop');
}

function uploadFile(){
	doGet('fileserver/file/folder!myfolder');
}

function translate(){
	var fs = "fromUrl="+currentHref;
	var i = 0
	for(fid in selectFiles){
		
		if(selectFiles[fid])fs+="&files["+i+"]="+fid;
	    i++;
	}
	
	doGet("fileserver/file/translate-file!userselector?fileType="+fileType+"&"+fs);		
}


function logout(){
	window.open(logouturl, '_self', '');
}

function myExtend(wid) {
	var a=1+1;
}